package com.whz.generic.utils;

import lombok.experimental.UtilityClass;
import org.springframework.util.AntPathMatcher;

/**
 * @author whz
 */
@UtilityClass
public class PathUtils {
    private static final AntPathMatcher ANT_PATH_MATCHER = new AntPathMatcher();

    /**
     * full match path
     *
     * @param pattern 路径模式
     * @param path    目标路径
     * @return true:完全匹配
     */
    public boolean match(String pattern, String path) {
        return ANT_PATH_MATCHER.match(pattern, path);
    }

    /**
     * match path starter
     *
     * @param pattern 路径模式
     * @param path    目标路径
     * @return true 匹配
     */
    public boolean matchStart(String pattern, String path) {
        return ANT_PATH_MATCHER.matchStart(pattern, path);
    }
}